<?php

namespace app\admin\validate\org;

use think\Validate;

class Orgcate extends Validate
{
    /**
     * 验证规则
     */
    protected $rule = [
        'name'=>'require|unique:org_cate,name|max:255'
    ];
    /**
     * 提示消息
     */
    protected $message = [
        'name.require'  => '名称必须',
        'name.max'      => '名称最多不能超过255个字符',
        'name.unique'   => '名称已存在'
    ];
    /**
     * 验证场景
     */
    protected $scene = [
        'add'  => ['name'],
        'edit' => [],
    ];
    
    protected function checkMobile($value){
        if( preg_match("/^1[345789]\d{9}$/", $value) ){
            return true;
        }
        return false;
    }
}
